/**
示例 1：

输入：["h","e","l","l","o"]
输出：["o","l","l","e","h"]
示例 2：

输入：["H","a","n","n","a","h"]
输出：["h","a","n","n","a","H"]

 */

/**
 * @param {character[]} s
 * @return {void} Do not return anything, modify s in-place instead.
 */
var reverseString = function (s) {
    const len = s.length % 2 ? (parseInt(s.length / 2) + 1) : parseInt(s.length / 2)
    for (let index = 0; index < len; index++) {
        if (len - 1 != index) {
            [s[index], s[s.length - index - 1]] = [s[s.length - index - 1], s[index]]
        }

    }
    return s

};

console.log(reverseString(["H", "a", "n", "n", "a", "h"]))
console.log(reverseString(["o", "l", "l", "e", "h"]))